package thread;

public class MyThread extends Thread {
	@Override
	public void run() {
		try {
			for( int i=0;i<10;i++){
				//线程跑到5的时候喊停
				if(i==5){
					interrupt();//做一个中断标记
				}
				if(isInterrupted()==false){//未中断则输出打印
					Thread.sleep(500);
					System.out.println(Thread.currentThread().getName()+"正在运行"+i);
				}
				
			}
		} catch (InterruptedException e) {
	
			e.printStackTrace();
		}
		
	}
}
